/*
 * Tag.java
 * business
 *
 * Created by ChenTao on 2016/9/9.
 *
 * Copyright (c) 2016年 yidiandao. All rights reserved.
 */
package com.yidiandao.business.data.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

/**
 * 标签实体.
 */
public class Tag implements Parcelable, ITag {

    public static final Creator<Tag> CREATOR =
            new Creator<Tag>() {
                @Override
                public Tag createFromParcel(Parcel source) {
                    return new Tag(source);
                }

                @Override
                public Tag[] newArray(int size) {
                    return new Tag[size];
                }
            };

    /**
     * 标签标识.
     */
    @SerializedName("id")
    private String id;
    /**
     * 标签名称.
     */
    @SerializedName("name")
    private String name;

    private boolean enable = true;

    private boolean selected;

    public Tag(Parcel in) {
        id = in.readString();
        name = in.readString();
    }

    public Tag() {
    }

    public Tag(String tag) {
        id = String.valueOf(System.currentTimeMillis());
        name = tag;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    @Override
    public boolean isEnable() {
        return enable;
    }

    @Override
    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    @Override
    public boolean isSelected() {
        return selected;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(id);
        dest.writeString(name);
    }
}
